﻿
@{
    Layout = null;
}

<link href="~/BootstrapS/css/bootstrap.min14ed.css" rel="stylesheet" />
<link href="~/BootstrapS/css/font-awesome.min93e3.css" rel="stylesheet" />
<link href="~/BootstrapS/css/animate.min.css" rel="stylesheet" />
<link href="~/BootstrapS/css/style.min862f.css" rel="stylesheet" />
<script src="~/vue/axios.min.js"></script>
<script src="~/vue/qs.min.js"></script>
<script src="~/vue/vue.min.js"></script>
<body>
    <div id="Content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title">添加病房</h4>
        </div>
        <div class="modal-body">
            <div style="margin-left:40px;margin-top:-10px;margin-bottom:400px">
                <div class="col-md-6" style="width:500px">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">病房编号：</label>
                        <div class="col-sm-9">
                            <input type="text" v-model="sive.Number" id="text1" name="" class="form-control" placeholder="请输病房编号">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top:50px">
                        <label class="col-sm-3 control-label">病人姓名：</label>
                        <div class="col-sm-9">
                            <input type="text" v-model="sive.PatientName" id="text2" name="" class="form-control" placeholder="请输病人姓名">

                        </div>
                    </div>
                    <div class="form-group" style="margin-top:110px">
                        <label class="col-sm-3 control-label">出院日期：</label>
                        <div class="col-sm-9">
                            <input type="text" v-model="sive.RoomIntensiveTimeEnd" id="text3" name="" class="form-control" placeholder="请输入出院日期">

                        </div>
                    </div>
                </div>
                <div class="col-md-6" style="width:500px;margin-top:20px">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">病房类型：</label>
                        <div class="col-sm-9">
                            <select class="form-control" id="select1" v-model="RoomTypeId">
                                <option v-bind:value="0">请选择病房类型</option>
                                <option v-for="item in info" v-bind:value="item.roomType_Id">{{item.roomType_Name}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" style="margin-top:50px">
                        <label class="col-sm-3 control-label">分配日期：</label>
                        <div class="col-sm-9">
                            <input type="text" v-model="sive.RoomIntensiveTimeBegin" id="text4" name="" class="form-control" placeholder="请输入分配日期">

                        </div>
                    </div>
                    <div class="form-group" style="margin-top:110px">
                        <label class="col-sm-3 control-label">医生姓名：</label>
                        <div class="col-sm-9">
                            <input type="text" v-model="sive.DoctorName" id="text5" name="" class="form-control" placeholder="请输入医生姓名">

                        </div>
                    </div>
                </div>
                <div class="col-md-6" style="width:1000px">
                    <div class="form-group" style="margin-top:20px">
                        <label class="col-sm-3 control-label">备注信息：</label>
                        <div class="col-sm-9" style="margin-left:118px;margin-top:-20px">
                            <textarea id="TextArea1" v-model="sive.RoomIntensiveRemark" rows="2" cols="20" class="form-control" placeholder="请输入备注信息" style="width:320px"></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-primary" v-on:click="AddRoom">保存</button>
        </div>
    </div>
</body>
<script src="~/BootstrapS/js/jquery.min.js"></script>
<script src="~/BootstrapS/js/bootstrap.min.js"></script>
<script src="~/BootstrapS/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="~/BootstrapS/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="~/BootstrapS/js/plugins/layer/layer.min.js"></script>
<script src="~/BootstrapS/js/hplus.min.js"></script>
<script src="~/BootstrapS/js/contabs.min.js"></script>
<script src="~/BootstrapS/js/plugins/pace/pace.min.js"></script>
<script>
    new Vue({
        el: '#Content',
        data() {
            return {
                info: '',
                RoomTypeId: 0,
                sive: {
                    Number: '',
                    PatientName: "",
                    RoomIntensiveTimeEnd: "",
                    RoomTypeName: "",
                    RoomIntensiveTimeBegin: "",
                    DoctorName: "",
                    RoomIntensiveRemark: ""
                }
            }

        },
        mounted: function () {
            axios
                .get('/Rooms/GetRoomTypes')
                .then(response => (this.info = response.data))
                .catch(function (eatch) {
                    console.log(eatch);
                })
        },

        methods: {
            AddRoom: function () {
                var obj = {
                    RoomIntensive_Number: this.sive.Number,
                    Patient_Name: this.sive.PatientName,
                    RoomIntensive_TimeEnd: this.sive.RoomIntensiveTimeEnd,
                    RoomType_Id: this.RoomTypeId,
                    RoomIntensive_TimeBegin: this.sive.RoomIntensiveTimeBegin,
                    Doctor_Name: this.sive.DoctorName,
                    RoomIntensive_Remark: this.sive.RoomIntensiveRemark
                };
                axios
                    .post('/Rooms/AddRooms', window.Qs.stringify(obj))
                    .then(response => {
                        if (response.data != null) {
                            alert("添加成功");
                            location.href = '/Rooms/GetRoom';
                        }

                    })

                    .catch(function (error) {
                        console.log(error);
                    })
            },

        }
        //$(".demo2").click(function () {
        //    swal
        //        ({
        //            title: "太帅了",
        //            text: "小手一抖就打开了一个框",
        //            type: "success"
        //        })
        //});

    });

    //.then(function (response) {
                    //    if (response.data.success == true) {
                    //        swal({
                    //            title: response.data.message,
                    //            text: "",
                    //            type: "success",
                    //            confirmButtonText: "确定",
                    //            closeOnConfirm: false
                    //        }, function () {
                    //            location.reload();
                    //        })
                    //    }
                    //    else {
                    //        swal({
                    //            title: response.data.message,
                    //            text: "",
                    //            type: "success",
                    //            confirmButtonText: "确定",
                    //            closeOnConfirm: false
                    //        }, function () {
                    //            location.reload();
                    //        })
                    //    }
                    //})
</script>
